﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml.Serialization;
using System.IO;

namespace UnitTest
{
    public delegate void DoSomething(int a);

    public delegate void DoSomething2(int a);
    public class MockEntity
    {

        public int ID
        {
            get;
            set;
        }

        public string Name
        {
            get;
            set;
        }
    }

    public class MockEntity2
    {
        public int ID
        {
            get;
            set;
        }

        public string Name
        {
            get;
            set;
        }

        public string Description
        {
            get;
            set;
        }
    }

    [Serializable]
    public class StaticGreatWonderModel
    {
        private int mID;
        /// <summary>
        /// 奇迹ID.
        /// </summary>
        public int ID
        {
            get
            {
                return this.mID;
            }
            set
            {
                this.mID = value;
            }
        }

        private string mName;
        /// <summary>
        /// 奇迹名称.
        /// </summary>
        public string Name
        {
            get
            {
                return this.mName;
            }
            set
            {
                this.mName = value;
            }
        }

        private GreatWonderType mType;
        /// <summary>
        /// 奇迹类型.
        /// </summary>
        public GreatWonderType Type
        {
            get
            {
                return this.mType;
            }
            set
            {
                this.mType = value;
            }
        }

        private string mDescription;
        /// <summary>
        /// 奇迹描述.
        /// </summary>
        public string Description
        {
            get
            {
                return this.mDescription;
            }
            set
            {
                this.mDescription = value;
            }
        }


    }
    /// <summary>
    /// 奇迹类别，大类，根据影响不同分.
    /// </summary>
    public enum GreatWonderType
    {
        none = 0,
        /// <summary>
        /// 类型1(大斗兽场、紫禁城、巨人像).
        /// </summary>
        TypeOne = 1,
        /// <summary>
        /// 类型2（神谕、复活节岛石像群、阿尔忒弥斯神庙）.
        /// </summary>
        TypeTwo = 2,
        /// <summary>
        /// 类型3（圣索菲亚、吴哥窟、瑞光大金塔）.
        /// </summary>
        TypeThree = 3
    }

    /// <summary>
    /// 大奇迹状态.
    /// </summary>
    public enum GreatWonderStatus
    {
        /// <summary>
        /// 未开放.
        /// </summary>
        Unopened = 0,
        /// <summary>
        /// 争夺期.
        /// </summary>
        InPlundering = 1,
        /// <summary>
        /// 已占领.
        /// </summary>
        Occupied = 2
    }

    public enum WonderGridType
    {
        /// <summary>
        /// 箱子.
        /// </summary>
        Box = 1,
        /// <summary>
        /// 平地.
        /// </summary>
        Grid = 2,
        /// <summary>
        /// 出口.
        /// </summary>
        Exit = 3,
        /// <summary>
        /// 入口.
        /// </summary>
        Door = 4,
        /// <summary>
        /// 假门.
        /// </summary>
        DeadDoor = 5
    }

    /// <summary>
    /// 副本状态.
    /// </summary>
    public enum WonderCopyStatus
    {
        /// <summary>
        /// 冷却.
        /// </summary>
        Coll = 1,
        /// <summary>
        /// 活跃.
        /// </summary>
        Active = 2
    }
    /// <summary>
    /// 数据模型类GreatWonderModel
    /// </summary>
    [Serializable]
    public class GreatWonderModel : StaticGreatWonderModel
    {
        #region 构造函数
        public GreatWonderModel()
        {
        }
        #endregion 构造函数

        #region 公共属性


        private GreatWonderStatus mStatus;
        /// <summary>
        /// 奇迹状态.
        /// </summary>
        public GreatWonderStatus Status
        {
            get
            {
                return this.mStatus;
            }
            set
            {
                this.mStatus = value;
            }
        }



        private int mGridID;
        /// <summary>
        /// 奇迹格子ID.
        /// </summary>
        public int GridID
        {
            get
            {
                return this.mGridID;
            }
            set
            {
                this.mGridID = value;
            }
        }


        private string mEffect;
        /// <summary>
        /// 奇迹影响XML数据存放效果.
        /// </summary>
        public string Effect
        {
            get
            {
                return this.mEffect;
            }
            set
            {
                this.mEffect = value;
            }
        }

        private DateTime mOpenDate;
        /// <summary>
        /// 开放时间.
        /// </summary>
        public DateTime OpenDate
        {
            get
            {
                return this.mOpenDate;
            }
            set
            {
                this.mOpenDate = value;
            }
        }

        private DateTime mCycStart;
        /// <summary>
        /// 争夺开始时间.
        /// </summary>
        public DateTime CycStart
        {
            get
            {
                return this.mCycStart;
            }
            set
            {
                this.mCycStart = value;
            }
        }

        private DateTime mOccupiedDate;
        /// <summary>
        /// 被占领时间.
        /// </summary>
        public DateTime OccupiedDate
        {
            get
            {
                return this.mOccupiedDate;
            }
            set
            {
                this.mOccupiedDate = value;
            }
        }
        /// <summary>
        /// 占领此奇迹的家族ID.
        /// </summary>
        private int fid = 0;

        public int FamilyID
        {
            get { return fid; }
            set { fid = value; }
        }
        //  public int FamilyID { get; set; }
        /// <summary>
        /// 占领此奇迹的家族名称.
        /// </summary>
        private string fname;

        public string FamilyName
        {
            get { return fname; }
            set { fname = value; }
        }
        //public string FamilyName { get; set; }


        [NonSerialized]
        private GreatWonderEffectModel mGreatWonderEffect;
        /// <summary>
        /// 奇迹影响.
        /// </summary>
        public GreatWonderEffectModel GreatWonderEffect
        {
            get
            {
                if (mGreatWonderEffect == null)
                {
                    if (!string.IsNullOrEmpty(this.Effect))
                    {
                        mGreatWonderEffect = new GreatWonderEffectModel(this.Effect);
                    }
                }
                return mGreatWonderEffect;
            }
            set
            {
                this.mGreatWonderEffect = value;
            }
        }

        #endregion 公共属性




    }

    /// <summary>
    /// 奇迹效果
    /// </summary>
    [Serializable]
    public class GreatWonderEffectModel
    {
        /// <summary>
        /// 默认构造函数.
        /// </summary>
        public GreatWonderEffectModel()
        {

        }
        /// <summary>
        /// 构造函数，通过反序列化字符串实现.
        /// </summary>
        /// <param name="effect"></param>
        public GreatWonderEffectModel(string effect)
        {
            XmlSerializer xmls = new XmlSerializer(this.GetType());
            GreatWonderEffectModel g;
            using (StringReader sr = new StringReader(effect))
            {
                g = (GreatWonderEffectModel)xmls.Deserialize(sr);
            }
            this.EffectBattleTimes = g.EffectBattleTimes;
            this.ExperienceAddition = g.ExperienceAddition;
            this.NpcPropNumAddition = g.NpcPropNumAddition;
            this.ProtectMainCastleNpcArmsID = g.ProtectMainCastleNpcArmsID;
            this.ProtectMainCastleNpcArmsNumBase = g.ProtectMainCastleNpcArmsNumBase;
            this.ReliveResourceAddition = g.ReliveResourceAddition;
            this.ReliveSoldierAddition = g.ReliveSoldierAddition;
            this.StrengthAdditon = g.StrengthAdditon;
        }


        #region 一类奇迹
        /// <summary>
        /// 守护主城NPC兵力ID.
        /// </summary>
        public int ProtectMainCastleNpcArmsID { get; set; }
        /// <summary>
        /// 守护主城兵力数量计算基数.
        /// </summary>
        public int ProtectMainCastleNpcArmsNumBase { get; set; }
        /// <summary>
        /// 战力加成比例.
        /// </summary>
        public double StrengthAdditon { get; set; }
        #endregion

        #region 二类奇迹
        /// <summary>
        /// 复活士兵需资源减少比例.
        /// </summary>
        public double ReliveResourceAddition { get; set; }
        /// <summary>
        /// 复活士兵数量加成
        /// </summary>
        public double ReliveSoldierAddition { get; set; }
        #endregion

        #region 三类奇迹
        /// <summary>
        /// 影响的战斗次数.
        /// </summary>
        public int EffectBattleTimes { get; set; }
        /// <summary>
        /// 获得经验值加成比例.
        /// </summary>
        public double ExperienceAddition { get; set; }
        /// <summary>
        /// npc道具数量多出比例.
        /// </summary>
        public double NpcPropNumAddition { get; set; }
        #endregion

    }
}
